
package com.ukao.steward.pesenter.logistics;

import com.ukao.steward.base.BasePresenter;
import com.ukao.steward.bean.LogisticsCountBean;
import com.ukao.steward.bean.StringBean;
import com.ukao.steward.bean.ValetCountBean;
import com.ukao.steward.consts.Constant;
import com.ukao.steward.consts.SaveParams;
import com.ukao.steward.retrofit.ApiCallback;
import com.ukao.steward.view.logistics.HomeView;

import java.util.HashMap;

/**
 * Created by ukaodev on 2017/6/28.
 */

public class HomePesenter extends BasePresenter<HomeView> {
    private boolean isloaderr;

    public HomePesenter(HomeView view) {
        attachView(view);
    }


    /**
     *首页  物流人员消息
     */
    public void batchCount(     ) {
        HashMap mHashMap = new HashMap<String, String>();
        mHashMap.put("accessToken", SaveParams.getToken());
        addSubscription(apiStores.batchCount(Constant.createParameter(mHashMap)),
                new ApiCallback<LogisticsCountBean>() {
                    @Override
                    public void onSuccess(LogisticsCountBean model) {

                        if (model.getHttpCode() == 200) {

                            mvpView.batchCountSucceed(model.getData());
                        }

                    }

                    @Override
                    public void onFinish() {
                        mvpView.loadfinish();
                    }
                });
    }

    /**
     *首页 取送人员消息
     */
    public void takeCount(     ) {


        HashMap mHashMap = new HashMap<String, String>();
        mHashMap.put("accessToken", SaveParams.getToken());
        addSubscription(apiStores.takeCount(Constant.createParameter(mHashMap)),
                new ApiCallback<ValetCountBean>() {
                    @Override
                    public void onSuccess(ValetCountBean model) {

                        if (model.getHttpCode() == 200) {

                            mvpView.ValetCountSucceed(model.getData());
                        }

                    }

                    @Override
                    public void onFinish() {
                        mvpView.loadfinish();


                    }
                });



    }


    /**
     * 支付解锁
     * @param orderId
     */
    public void unlockOrder(String orderId      ) {
        HashMap mHashMap = new HashMap<String, String>();
        mHashMap.put("orderId", orderId);
        mHashMap.put("accessToken", SaveParams.getToken());
        addSubscription(apiStores.unlockOrder(Constant.createParameter(mHashMap)),
                new ApiCallback<StringBean>() {
                    @Override
                    public void onSuccess(StringBean model) {
                        if (model.getHttpCode() == 200) {

                        } else {

                        }

                    }


                    @Override
                    public void onFinish() {

                    }

                });
    }







}
